import { applyDecorators, SetMetadata, UseGuards } from '@nestjs/common';
import { PermissionGuard } from '../auth/permission.guard';

export const RequirePermission = (permissions, logic = 'OR') => {
  return applyDecorators(
    SetMetadata('requiredPermission', { permissions, logic }),
    UseGuards(PermissionGuard),
  );
};
